package main

import (
	"context"
	"fmt"
	"grpc-go-demo/echo"
	"log"

	"google.golang.org/grpc"
)

func main() {
	connect, err := grpc.Dial("localhost:8080", grpc.WithInsecure())
	if err != nil {
		log.Fatal(err.Error())
	}
	defer connect.Close()

	client := echo.NewEchoClient(connect)
	reply, err := client.UnaryEcho(context.Background(), &echo.EchoRequest{Message: "shangchao"})
	if err != nil {
		log.Println(err.Error())
	}
	fmt.Println(reply.GetMessage())

}
